package com.guch.help.utils;

import android.os.Build;

public class DeviceUtils {

    public static String getDeviceManufacturerName() {
        String manufacturer = Build.MANUFACTURER; // 设备制造商
        String model = Build.MODEL; // 设备型号

//        String manufacturer = Build.MANUFACTURER; // 设备制造商
//        String model = Build.MODEL; // 设备型号
        String modelName = Build.DEVICE; // 型号名称
//        String modelName = "";


        if (model.startsWith(manufacturer)) {
            return capitalize(model);
        } else {
            return capitalize(manufacturer);
        }
    }

    public static String getDeviceModeName() {
        String manufacturer = Build.MANUFACTURER; // 设备制造商
        String model = Build.MODEL; // 设备型号

//        String manufacturer = Build.MANUFACTURER; // 设备制造商
//        String model = Build.MODEL; // 设备型号
        String modelName = Build.DEVICE; // 型号名称
//        String modelName = "";

        return capitalize(model);
    }

    private static String capitalize(String s) {
        if (s == null || s.length() == 0) {
            return "";
        }
        char first = s.charAt(0);
        if (Character.isUpperCase(first)) {
            return s;
        } else {
            return Character.toUpperCase(first) + s.substring(1);
        }
    }

}
